# Load Data
fig.path <- "results/graph/"
fig.name <- paste0(fig.path, "app_fig_f04.pdf")
w <- "women march"

## Registration subdistricts with societies, roads, and march path

db_news_wmnmarch <- readRDS("data/newspapers/mentions_womenmarch.RDS")

## Trends

summ <-   db_news_wmnmarch %>%
    group_by( march_path) %>%
    summarise_at(c("news_total"), sum) %>%
    subset(ym(datemonth)!="1913-09-01") %>%
    subset(month(datemonth) != 3) # Deals with homonymy of "march path" in march

kols <- ghibli_palette(name = "PonyoMedium")[c(2,4)]

p <- ggplot(data = summ , aes(x=ym(datemonth), 
      y = news_total)) + 
    geom_line(aes(col = march_path))  + 
    geom_vline(xintercept=ymd("1913-07-01") ,linetype="dashed", size=0.2) +
    scale_color_manual(values = kols, name = "March Path") +
    theme_light(base_size = 16) + 
    labs( x = "Date" , y = "Total Mentions", caption = paste("Search term:", w))

ggsave(plot = p, fig.name, width = 8, height = 6)

rm(list=
    setdiff(ls()[sapply(ls(), function(x) any(class(get(x)) == 'data.frame'))],
    c("Re","Ind")))
rm(p)